package com.bdyc.util;

import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class MyDateFormat {
	public static String getStringDate(Date date){
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
		Date taskDate = new Date();
		return sdf.format(taskDate);
	}
	public static String getFromatDate(Date date){
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
		Date taskDate = new Date();
		return sdf.format(taskDate);
	}
	public String  getDate(){
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
		Long a = new Date().getTime();
		String bb = sdf.format(a);
		return  bb;
	}
	public static Timestamp getTime(){
		return new Timestamp(System.currentTimeMillis());
	}
	
	public static  Long getStartDate(String dateString){
		String startString = dateString + " 00:00:00";
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		Date date;
		try {
			date = sdf.parse(startString);
			long longDate = date.getTime();
			return longDate;
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return null;
	}
	public static  Long getEndDate(String dateString) {
		String endString = dateString + " 23:59:59";
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		Date date;
		try {
			date = sdf.parse(endString);
			long longDate = date.getTime();
			return longDate;
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return null;
	}
}
